// src/router/index.tsx
import { createBrowserRouter, RouterProvider } from "react-router-dom";

import loadable from "@shared/loadable";
import AuthRoute from "@router/authRoute";
import {lazy} from "react";
import Fast from "@pages/fast";
import Department from "@pages/department";
import Illness from "@pages/illness";
import ConsultPay from "@pages/consultPay";
import ConsultPayGuard from "@router/consultPayGuard";
import Room from "@pages/room";
const Home = loadable(lazy(() => import("@pages/home")));
const Login = loadable(lazy(() => import("@pages/login")));
const Personal = loadable(lazy(() => import("@pages/personal")));
const Layout = loadable(lazy(() => import("@shared/layout")));
const Notice = loadable(lazy(() => import("@pages/article/notice")));
const Article = loadable(lazy(() => import("@pages/article")));
const Patient = loadable(lazy(() => import("@pages/patient")));
export const router = createBrowserRouter([
  {
    path: "",
    element: <AuthRoute children={<Layout />} />,
    children: [
      { path: "", element: <Home /> },
      { path: "/personal", element: <Personal /> },
      { path: "notify", element: <Notice /> },
      { path: "article", element: <Article /> },
      {path: "patient", element: <Patient />},
      {path: "fast", element: <Fast />,},
      {path: "department", element: <Department />,},
      {path: "illness", element: <Illness />,},
      { path: "consultPay",  element: <ConsultPayGuard children={<ConsultPay />} />,},
      {
        path: "room",
        element: <Room />,
      },

    ],
  },
  { path: "/login", element: <Login /> },
  { path: "personal", element: <Personal /> },
]);

export default function AppRouter() {
  return <RouterProvider router={router} />;
}
